//
//  ConversionPriceTableViewCell.m
//  SafeFoodManagerDemo
//
//  Created by pc on 2018/3/22.
//  Copyright © 2018年 bob. All rights reserved.
//

#import "ConversionPriceTableViewCell.h"

@implementation ConversionPriceTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)setData:(PriceListData *)data{
    self.GoodNameLabel.text = data.goodsName;
    self.costTF.text = [NSString stringWithFormat:@"%.2f",data.price];
    self.costTF.delegate = self;
    self.saleTF.delegate = self;
    
    self.costTF.tag= [data.ROW_NUMBER integerValue]-1;
    self.saleTF.text = [NSString stringWithFormat:@"%.2f",data.salePrice];
    self.saleTF.tag= [data.ROW_NUMBER integerValue]-1+1000;
    
    
    
}



- (void)textFieldDidEndEditing:(UITextField *)textField{
    
   // DLog(@"%@",textField);
    
   NSLog(@"%ld--text-%@",(long)textField.tag,textField.text);
    if ([textField isEqual:self.costTF]) {
        
        [self.delegate costPrice:self.costTF.text costIndex:self.costTF.tag];
      
        
        
        
        }else{
        
         //[self.delegate costPrice:self.saleTF.text costIndex:self.saleTF.tag-1000];
            [self.delegate salePrice:self.saleTF.text costIndex:self.saleTF.tag-1000];
        
    }
    
}
-(void)textFieldDidBeginEditing:(UITextField *)textField{
    
    textField.text = @"";
    textField.textColor = [UIColor redColor];
    
    
    
}




@end
